import QtQuick 1.0
import "../Models"
import "../Delegates"


//メインメニュー

Rectangle {
    id: _root
    x: 0
    y: 0
    radius: 5
    gradient: Gradient {
        GradientStop {
            position: 0
            color: "#040240"
        }

        GradientStop {
            position: 1
            color: "#000a16"
        }
    }
    border.width: 2
    border.color: "#6bcbf7"

    ListView {
        id: _list
        anchors.fill: parent
        anchors.topMargin: 4
        anchors.leftMargin: 4
        anchors.bottomMargin: 4
        anchors.rightMargin: 4

        model: ModelContextMenu{
        }

        delegate: DelegateContext {
            id: _delegate
            itemIndex: _index
            itemTitle: _title

            Component.onCompleted: {
                _root.width = _delegate.width + 10;
                _root.height = _delegate.height * _list.count + 10;
            }

            MouseArea {
                anchors.fill: parent

                onClicked: {
                    switch(itemIndex){
                    case 0:
                        //Auth
                        _menuContainer.state = "Auth";
                        break;
                    case 1:
                        //Exit
                        _menuContainer.state = "ExitCaution";
                        break;
                    case 2:
                        //About
                        _menuContainer.state = "AboutCaution";
                        break;
                    case 3:
                        break;
                    default:
                        break;
                    }

                    //メニューを消す
//                    _menuContainer.state = "";
                }
            }
        }
    }
}

